/**
 * 
 */
package remato.domain.server.ejb;

import static javax.persistence.GenerationType.AUTO;
import static javax.persistence.CascadeType.ALL;
import static javax.persistence.InheritanceType.TABLE_PER_CLASS;

import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;

import remato.domain.common.UseCaseDefinition;
import remato.domain.common.UseCaseSystem;
import remato.domain.common.impl.UseCaseSystemImpl;

/**
 * @author Petter L. H. Eide
 *
 */
@Entity
@Inheritance(strategy=TABLE_PER_CLASS)
public class UseCaseSystemEjb extends UseCaseSystemImpl implements
		UseCaseSystem {

	@Override
	@Id
	@GeneratedValue(strategy=AUTO)
	public Long getDbId() {
		return super.getDbId();
	}

	/**
	 * This is a Unidirectional with join table, meaning the children
	 * (Stakeholder) do not have a reference to the parent (RequirementSystem)
	 */
	@Override
	@OneToMany(targetEntity = UseCaseDefinitionEjb.class, cascade = { ALL })
	@JoinColumn(name="requirementSystem")
	public Set<UseCaseDefinition> getUseCaseDefinitions() {
		return super.getUseCaseDefinitions();
	}

	/**
	 * Needed to trigger CGLib proxy (ie. if other CGLib-proxies is used as 
	 * parameter.)
	 * 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		return super.equals(obj);
	}

}
